Skip to content

Finalize public OpenAPI v1 - #721

Open
inglor wants to merge 3 commits into
archlinux:masterfrom
inglor:openapi
Open

inglor wants to merge 3 commits into
archlinux:masterfrom
inglor:openapi

Conversation

@inglor

@inglor inglor commented Jul 9, 2026

Copy link
Copy Markdown
Member

No description provided.

@inglor
inglor requested a review from jelly July 9, 2026 07:34
Comment thread api/routes/mirrors.py Outdated
return value.days * 24 * 3600 + value.seconds


def _td_seconds_or_none(value) -> int | None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a datetime no? So can be typed as such. Same as above.

Comment thread api/routes/mirrors.py Outdated
def _url_to_schema(url) -> MirrorUrlSchema:
return MirrorUrlSchema(
url=url.url,
protocol=str(url.protocol),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is url.protocol.protocol, yes a bit confusing

Comment thread api/routes/mirrors.py
return MirrorUrlWithLogsSchema(**base.dict(), logs=logs)


@router.get("/status/", response=MirrorStatusSchema, url_name="mirror-status")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm this one is missing @cache_control(max_age=311)

Comment thread api/routes/packages.py


@router.get("/pkgbase-maintainer", response=dict[str, list[str]], url_name="pkgbase-maintainer")
def pkgbase_maintainer(request):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This endpoint was cached before max_age=300

Comment thread api/routes/public.py
router = Router(tags=["public"])


@router.get("/", response=PGPKeysSchema, url_name="pgp-keys")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was cached before @cache_page(1789)

Comment thread api/routes/todolists.py Outdated
# Same as with /todo/{slug}/json
todolist = get_object_or_404(Todolist, slug=slug)
to_json = json.dumps(todolist, ensure_ascii=False, cls=TodoListJSONEncoder)
return HttpResponse(to_json, content_type='application/json')

@jelly jelly Sep 19, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this not use the django-ninja stuff?

@inglor
inglor force-pushed the openapi branch 2 times, most recently from c09ee57 to fe9f8fd Compare September 19, 2026 16:07
Closes part of archlinux#199

Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>
Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>
Extend the Django Ninja API to cover the remaining public read-only JSON endpoints under /api/v1/

Closes part of archlinux#199.
Closes archlinux#532.

Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants